#include "tcpServer.hpp"
#include "memory"
#include "daemon.hpp"
using namespace Server;
static void Usage(std::string proc)
{
    std::cout << "Usage:\n\t" << proc << "serverPort\n\n";
}
//./tcpServer local_port
int main(int argc, char *argv[])
{
    if (argc != 2) // 判断外部传入的参数是否为2
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    uint16_t port = std::stoi(argv[1]);
    std::unique_ptr<TcpServer> tsvr(new TcpServer(port));
    tsvr->InitServer();
    DaemonSele(); // 守护进程化，让这个独立的孤儿进程去启动服务器
    tsvr->Start();
    return 0;
}